--[[/**
 * 蕾拉将自己的伤害转化为 生命值, 治疗自己
-- */]]

---@class BuffEffect92023100 : BaseBuffEffect
BuffEffect92023100 = ClientFight.CreateClass("BuffEffect92023100", ClientFight.BaseBuffEffect)
local t = BuffEffect92023100

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    local fightResult = parameters[3];
    local fighter = buff.target;
    local effectVal = buff.buffBean.f_BuffEffectValue;
    if (fightResult.damage <= 0) then
        return IBuffEffect.FAIL;
    end
    local addHp = (fightResult.damage * Utils.toRatio(effectVal[1]));

    DamageManager.setFighterHp(fight, buff.target, fighter, null,
            DamageResultTypeEnum.HEAL, addHp, buff.target.hp + addHp, true, false, true);
    BuffManager.addBuff(fight, buff.skill, fighter, buff.target, false, effectVal[2], 1);
    local logAddHp = addHp;
    SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter %s Buff%s 伤害为%s,转化增加生命值%s,目标为%s",
            fight.frame, fighter.fighterId, buff.modelId, fightResult.damage, logAddHp, buff.target.fighterId
    ));
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()